/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author valiadam
 */
@Entity
@Table(name = "loggedin", catalog = "ltschat", schema = "")
@NamedQueries({@NamedQuery(name = "Loggedin.findAll", query = "SELECT l FROM Loggedin l"),
@NamedQuery(name = "Loggedin.findById", query = "SELECT l FROM Loggedin l WHERE l.id = :id"),
@NamedQuery(name = "Loggedin.findByLogindate", query = "SELECT l FROM Loggedin l WHERE l.logindate = :logindate"),
@NamedQuery(name = "Loggedin.getLoggedInUsers", query = "SELECT l.userid FROM Loggedin l")})
public class Loggedin implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Column(name = "logindate")
    @Temporal(TemporalType.TIME)
    private Date logindate;
    @JoinColumn(name = "conversationid", referencedColumnName = "id")
    @ManyToOne
    private Conversation conversationid;
    @JoinColumn(name = "userid", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private User userid;

    public Loggedin() {
    }

    public Loggedin(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getLogindate() {
        return logindate;
    }

    public void setLogindate(Date logindate) {
        this.logindate = logindate;
    }

    public Conversation getConversationid() {
        return conversationid;
    }

    public void setConversationid(Conversation conversationid) {
        this.conversationid = conversationid;
    }

    public User getUserid() {
        return userid;
    }

    public void setUserid(User userid) {
        this.userid = userid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Loggedin)) {
            return false;
        }
        Loggedin other = (Loggedin) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Loggedin[id=" + id + "]";
    }

}
